package io.github.jast90.internship;

import io.github.jast90.web.common.result.CommonResult;
import io.github.jast90.web.common.result.MyResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by jast90 on 2021/3/12
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    //其他未处理的异常
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Object exceptionHandler(Exception e){
        e.printStackTrace();
        return new CommonResult<>(MyResult.FAIL);
    }
}
